package cz.muni.fi.pa165.musiclibrary.musiclibraryclient;

import cz.muni.fi.pa165.musiclibrary.Genre;
import java.util.ArrayList;
import java.util.List;
import javax.swing.AbstractListModel;

/**
*
* @author Radoslav Stefanik 
* 2012-12-09T21:59:03+0100
*/
public final class GenreListModel extends AbstractListModel<Genre> {

    private List<Genre> genres;

    public GenreListModel() {
        genres = new ArrayList<Genre>();
    }
    
    public void setGenres(List<Genre> genres) {
        this.genres = genres;
        fireContentsChanged(this, 0, getSize());
    }
    
    @Override
    public int getSize() {
        return genres.size();
    }

    @Override
    public Genre getElementAt(int index) {
        return genres.get(index);
    }

}